<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

/*
 采用 laravel 的 route 标准
 Route::resource('photos', 'PhotosController', ['names' => [
    'index'   => 'photos.index',    // get-列表-显示所有记录
    'create'  => 'photos.create',   // get-创建页面
    'store'   => 'photos.store',    // post-保存
    'show'    => 'photos.show',     // get-显示单条记录
    'edit'    => 'photos.edit',     // get-编辑记录编辑页面
    'update'  => 'photos.update',   // put-更新
    'destroy' => 'photos.destroy',  // delete-删除
]]);*/

// 验证码
Route::get('admin/get-captcha', \app\controller\admin\AuthController::class.'/getCaptcha');
// 管理员后台-登录页面
Route::get('admin/user/login', \app\controller\admin\AuthController::class.'/loginPage');
// 管理员后台-登录
Route::post('admin/user/login', \app\controller\admin\AuthController::class.'/login');


// 管理员后台-首页
Route::get('/', \app\controller\admin\HomeController::class.'/index')->middleware(['admin_auth']);
Route::get('admin', \app\controller\admin\HomeController::class.'/index')->middleware(['admin_auth']);
Route::get('admin/index', \app\controller\admin\HomeController::class.'/index')->middleware(['admin_auth']);
// 管理员-登出
Route::get('admin/user/logout', \app\controller\admin\AuthController::class.'/logout')->middleware(['admin_auth']);
// 管理员-编辑信息
Route::get('admin/user/edit2', \app\controller\admin\AdminUserController::class.'/edit2')->middleware(['admin_auth']);
Route::put('admin/user/update2', \app\controller\admin\AdminUserController::class.'/update2')->middleware(['admin_auth']);

// 管理员后台
Route::group('admin', function(){
    // 菜单
    Route::group('menu', function(){
        Route::get('index', \app\controller\admin\AdminMenuController::class.'/index');
        Route::get('create', \app\controller\admin\AdminMenuController::class.'/create');
        Route::post('store', \app\controller\admin\AdminMenuController::class.'/store');
        Route::get('show', \app\controller\admin\AdminMenuController::class.'/show');
        Route::get('edit', \app\controller\admin\AdminMenuController::class.'/edit');
        Route::put('update', \app\controller\admin\AdminMenuController::class.'/update');
        Route::delete('destroy', \app\controller\admin\AdminMenuController::class.'/destroy');
    });
    // 角色
    Route::group('role', function(){
        Route::get('index', \app\controller\admin\AdminRoleController::class.'/index');
        Route::get('show', \app\controller\admin\AdminRoleController::class.'/show');
        Route::get('create', \app\controller\admin\AdminRoleController::class.'/create');
        Route::get('edit', \app\controller\admin\AdminRoleController::class.'/edit');
        Route::post('store', \app\controller\admin\AdminRoleController::class.'/store');
        Route::put('update', \app\controller\admin\AdminRoleController::class.'/update');
        Route::delete('destroy', \app\controller\admin\AdminRoleController::class.'/destroy');
    });
    // 访问权限
    Route::group('permission', function (){
        Route::get('index', \app\controller\admin\AdminPermissionController::class.'/index');
        Route::get('show', \app\controller\admin\AdminPermissionController::class.'/show');
        Route::get('create', \app\controller\admin\AdminPermissionController::class.'/create');
        Route::get('edit', \app\controller\admin\AdminPermissionController::class.'/edit');
        Route::post('store', \app\controller\admin\AdminPermissionController::class.'/store');
        Route::put('update', \app\controller\admin\AdminPermissionController::class.'/update');
        Route::delete('destroy', \app\controller\admin\AdminPermissionController::class.'/destroy');
    });
    // 角色权限
    Route::group('role-permission', function(){
        Route::get('index', \app\controller\admin\AdminRolePermissionController::class.'/index');
        Route::get('show', \app\controller\admin\AdminRolePermissionController::class.'/show');
        Route::post('store', \app\controller\admin\AdminRolePermissionController::class.'/store');
    });
    // 系统参数
    Route::group('config', function (){
        Route::get('index', \app\controller\admin\AdminConfigController::class.'/index');
        Route::get('edit', \app\controller\admin\AdminConfigController::class.'/edit');
        Route::put('update', \app\controller\admin\AdminConfigController::class.'/update');
    });
    // 操作日志
    Route::group('action-log', function (){
        Route::get('index', \app\controller\admin\AdminActionLogController::class.'/index');
        Route::get('show', \app\controller\admin\AdminActionLogController::class.'/show');
    });
    // 管理员
    Route::group('user', function (){
        Route::get('index', \app\controller\admin\AdminUserController::class.'/index');
        Route::get('show', \app\controller\admin\AdminUserController::class.'/show');
        Route::get('create', \app\controller\admin\AdminUserController::class.'/create');
        Route::get('edit', \app\controller\admin\AdminUserController::class.'/edit');
        Route::post('store', \app\controller\admin\AdminUserController::class.'/store');
        Route::put('update', \app\controller\admin\AdminUserController::class.'/update');
        Route::delete('destroy', \app\controller\admin\AdminUserController::class.'/destroy');
    });
    // 管理员-绑定权限
    Route::group('bind-role', function(){
        Route::get('create', \app\controller\admin\AdminBindRoleController::class.'/create');
        Route::post('store', \app\controller\admin\AdminBindRoleController::class.'/store');
    });// group - admin/bind-role
    // 管理员-登录日志
    Route::group('user-login-log', function (){
        Route::get('index', \app\controller\admin\AdminUserLoginLogController::class.'/index');
        Route::get('show', \app\controller\admin\AdminUserLoginLogController::class.'/show');
    });
})->middleware(['admin_auth', 'admin_role_permission']);